home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_15 / Mission.script < prev    next >
Text File  |  2001-12-19  |  7KB  |  216 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. class CSurvivalMission extends
  11.   CBaseMission, CSurvivalMissionObjectList, CSurvivalMission_Strings,
  12.   CNavPointUser, CGermanParatrooperGenerator
  13. {
  14.   int GetAutoGeneratedUnitsQty()
  15.   {
  16.     return 6;
  17.   }
  18.  
  19.   void CSurvivalMission()
  20.   {
  21.     BaseMission_InitMission();
  22.  
  23.     BaseMission_UpdateLoadProgress();
  24.     CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
  25.     SetComponentPosition("DebugCamera",
  26.       matrix(
  27.         1.0, 0.0, 0.0, 8000.0,
  28.         0.0, 1.0, 0.0, 8000.0,
  29.         0.0, 0.0, 1.0,  600.0,
  30.         0.0, 0.0, 0.0,    1.0
  31.       ));
  32.  
  33.     // CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
  34.     BaseMission_UpdateLoadProgress();
  35.     CreateComponent("Atmosphere", "Atmosphere", "CSurvivalMission_Atmosphere");
  36.  
  37.     BaseMission_UpdateLoadProgress();
  38.     CreateComponent("Sky", "SkyObject", "CSurvivalMission_Sky");
  39.  
  40.     BaseMission_UpdateLoadProgress();
  41.     CreateComponent("Terrain", "ProgressiveTerrainObject", "CSurvivalMission_Terrain");
  42.  
  43.     BaseMission_UpdateLoadProgress();
  44.     CreateComponent("Forest", "Forest", "CSurvivalMission_Forest");
  45.  
  46.     BaseMission_UpdateLoadProgress();
  47.     CreateComponent( "AIController", "AIController", "CMission15_AIController");
  48.  
  49.     BaseMission_CreateObjects();
  50.   }
  51.  
  52.   //
  53.   //  'virtual' methods
  54.   //
  55.  
  56.   //
  57.   //  Objectives
  58.  
  59.   array m_MissionObjectivesStatuses =
  60.           array(
  61.             str_ObjectiveInProgress,
  62.             str_ObjectiveInProgress
  63.           );
  64.  
  65.   array m_BonusMissionObjectivesStatuses =
  66.           array(
  67.             str_ObjectiveInProgress
  68.                   );
  69.  
  70.  
  71.   //
  72.   //  Mission statistics
  73.  
  74.   string GetMissionStatistics()
  75.   {
  76.     return str_StatisticsTitle+m_GermanKilled;
  77.   }
  78.  
  79.   //
  80.   //  Mission navpoints
  81.  
  82.   array GetNavPoints()
  83.   {
  84.     array navpoints =
  85.       array(
  86.         GetNavPoint("NavPoint_01"),     // Benghazi Crossroad position
  87.         GetNavPoint("NavPoint_02"),     // Al-Bwairat Crossroad position
  88.         GetNavPoint("NavPoint_03"),     // Zillah position
  89.         GetNavPoint("NavPoint_04")      // Tobruq position
  90.       );
  91.     return navpoints;
  92.   }
  93.  
  94.   //
  95.   //  Mission map skin file
  96.  
  97.   string GetMapSkinFileName()
  98.   {
  99.     return "Missions/Mission_15/Map.skin";
  100.   }
  101.  
  102.   final int m_TobruqConvoyLost       = 18;
  103.   final int m_BenghaziConvoyLost     = 8;
  104.   final int m_BenghaziTankConvoyLost = 8;
  105.   final int m_AqaliaConvoyLost       = 10;
  106. //  final int m_TobruqConvoyLost       = 4;
  107. //  final int m_BenghaziConvoyLost     = 2;
  108. //  final int m_BenghaziTankConvoyLost = 2;
  109. //  final int m_AqaliaConvoyLost       = 4;
  110.  
  111.   final int m_RoadFlakLost           = 10;
  112.  
  113.   int m_GermanKilled = 0;
  114.   int m_TobruqConvoyKilled = 0;
  115.   int m_AqaliaConvoyKilled = 0;
  116.   int m_BenghaziConvoyKilled = 0;
  117.   int m_RoadFlakKilled = 0;
  118.  
  119.   boolean m_TobruqStopped   = false;
  120.   boolean m_BenghaziStopped = false;
  121. //  boolean m_BenghaziStopped = false;
  122.   boolean m_AqaliaStopped   = false;
  123.  
  124.   boolean Objective1      = false;
  125.   boolean Objective2      = false;
  126.   boolean Objective3      = false;
  127.   boolean BonusObjective1 = false;
  128.  
  129.   void ConvoyGetNavPoint_02()
  130.     {
  131.       BaseMission_DelayedQuit();
  132.     }
  133.  
  134.   void Wave1MemberStopped( string _idConvoy )
  135.     {
  136.       if ( m_TobruqStopped && m_BenghaziStopped && m_AqaliaStopped && !Objective1 )
  137.        {
  138.          Core_LogMessage("Wave 1 was stopped wit your help");
  139.          Objective1 = true;
  140.          BaseMission_CompleteObjective(0);
  141.        }
  142.     }
  143.   void OnGameObjectDestroyed(string _id)
  144.    {
  145.      BaseMission_OnGameObjectDestroyed(_id);
  146.  
  147.      if ( Core_IsStringStartsWith( _id, "15_G" ) )
  148.       {
  149.          m_GermanKilled = m_GermanKilled + 1;
  150.       }
  151.      if ( Core_IsStringStartsWith( _id, "15_GTobruq" ) )
  152.       {
  153.          m_TobruqConvoyKilled = m_TobruqConvoyKilled + 1;
  154.          if ( (m_TobruqConvoyKilled >= m_TobruqConvoyLost*0.7) && ( !m_TobruqStopped ) )
  155.           {
  156.              m_TobruqStopped = true;
  157.              Core_BroadcastEvent("Wave1MemberStopped", "Tobruq");
  158.              Core_LogMessage("Tobruq convoy has stopped. With "+m_TobruqConvoyKilled+" killed units");
  159.           }
  160.       }
  161.      if ( Core_IsStringStartsWith( _id, "15_GAqalia" ) )
  162.       {
  163.          m_AqaliaConvoyKilled = m_AqaliaConvoyKilled + 1;
  164.          if ( (m_AqaliaConvoyKilled >= m_AqaliaConvoyLost*0.7) && ( !m_AqaliaStopped ) )
  165.           {
  166.              m_AqaliaStopped = true;
  167.              Core_BroadcastEvent("Wave1MemberStopped", "Aqalia");
  168.              Core_LogMessage(" Al-Aqalia convoy has stopped. With "+m_AqaliaConvoyKilled+" killed units");
  169.           }
  170.       }
  171.      if ( Core_IsStringStartsWith( _id, "15_GBenghazi" ) )
  172.       {
  173.          m_BenghaziConvoyKilled = m_BenghaziConvoyKilled + 1;
  174.          if ( (m_BenghaziConvoyKilled >= (m_BenghaziConvoyLost+m_BenghaziTankConvoyLost)*0.7) && ( !m_BenghaziStopped ) )
  175.           {
  176.              m_BenghaziStopped = true;
  177.              Core_BroadcastEvent("Wave1MemberStopped", "Benghazi");
  178.              Core_LogMessage(" Benghazi convoy has stopped. With "+m_BenghaziConvoyKilled+" killed units");
  179.           }
  180.       }
  181.      if ( Core_IsStringStartsWith( _id, "15_AmmoBox" ) && !Objective2 )
  182.       {
  183.          Objective2 = true;
  184.          BaseMission_CompleteObjective(1);
  185.          Core_ScheduleTask("Bullets",
  186.                            OT_SendEventTo,
  187.                            10.0,
  188.                            "StartSovietAirBombing",
  189.                            300, 30.0,
  190.                            GetNavPoint("NavPoint_03"),
  191.                            300.0
  192.                             );
  193.       }
  194.  
  195.   // Check BonusObjective
  196.      if ( Core_IsStringStartsWith( _id, "15_GRoad_Flak" ) )
  197.       {
  198.          m_RoadFlakKilled = m_RoadFlakKilled + 1;
  199.          if ( (m_RoadFlakKilled >= m_RoadFlakLost) && ( !BonusObjective1 ) )
  200.           {
  201.             BonusObjective1 = true;
  202.             BaseMission_CompleteBonusObjective(0);
  203.           }
  204.       }
  205.  
  206.    }
  207.  
  208.   void OnMissionLoaded()
  209.   {
  210.     Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
  211.  
  212.     // Start mission music playing
  213.     Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 15);
  214.   }
  215. }
  216.